package day26;

import java.io.*;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Arrays;

public class Homework4 {
    public static void main(String[] args) throws ClassNotFoundException, IOException {
        File file=new File("C:\\Users\\梅穿内裤\\Desktop\\IOTest\\aa\\result.txt");
        if (!file.exists()){
            file.createNewFile();
        }
        FileWriter fw=new FileWriter(file);
        String name1="方法有：";
        String name2="属性有：";
        String name3="构造方法有：";
        Class c=Class.forName("day26.random");
        Method ms[]=c.getDeclaredMethods();
        for (Method m:ms){
            String methodName=m.getName();
            name1+=methodName+"\t";
        }
        fw.write(name1);
        Field fs[]=c.getFields();
        for (Field f:fs){
            String fieldName= f.getName();
            name2+=fieldName+"\t";
        }
        fw.write(name2);
        Constructor cs[]=c.getDeclaredConstructors();
        for (Constructor con:cs){
            String methodName=c.getName();
            name3+=methodName+"\t";
        }
        fw.write(name3);
        fw.close();
    }
}

class random{
    String name;
    String phone;

    public random(){}
    public random(String name, String phone) {
        this.name = name;
        this.phone = phone;
    }

    public void play(){}
    public void run(){}
}